package cn.itsy.web.controller;

import cn.itsy.pojo.Position;
import cn.itsy.service.position.PositionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * misterGay
 */
@Controller
@RequestMapping("positionController")
public class PositionController {
    //    position的service层引用
    @Resource(name = "positionServiceimpl")
    private PositionService positionService;

    @RequestMapping(value = "queryPositionAll", method = RequestMethod.GET)
    @ResponseBody
    public List<Position> queryPositionAll() {
        String querySql = " select * from position ";
        List<Position> positions = this.positionService.queryPositionAll(querySql);
        if (!positions.isEmpty()) {
            return positions;
        }
        return null;
    }
}
